package hku.cs.lunuo.rank;

import hku.cs.lunuo.rank.model.Statistic;

import java.util.HashMap;
import java.util.Set;

public class StmtStatistic extends Statistic{
	private HashMap<String, HashMap<Integer, StatisticProperty>> data 
		= new HashMap<String, HashMap<Integer, StatisticProperty>>();

	public void setStmt(String className, int ln,
			StatisticProperty property) {
		HashMap<Integer, StatisticProperty> indata = data.get(className);
		if(indata == null)
			indata = new HashMap<Integer, StatisticProperty>();
		StatisticProperty sp = indata.get(ln);
//		if(sp == null || sp.label.compareTo(property.label)<0)
			sp = property;	
		//Strategy1: use more suspicious SP for the different meta statement for the last statement
		//Strategy2: To dump Stmt XML only use success line 
		indata.put(ln, sp);
		data.put(className, indata);
	}

	public Set<String> getKlassNames() {
		return data.keySet();
	}

	public Set<Integer> getLine(String klassName) {
		return data.get(klassName).keySet();
	}

	public StatisticProperty getProperty(String klassName, Integer ln) {
		return data.get(klassName).get(ln);
	}

}
